<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="time"></div>
    <script>
      var time =   document.querySelector("#time")
      var d = 6;
      function setTime(){
          d--;
          time.innerHTML="时间："+d
          if(d==0){
              return  time.innerHTML='结束'
          }
          setTimeout('setTime()',1000)
      }
      setTime()
    </script>
</body>
</html>

<!-- https://blog.csdn.net/weixin_42693712/article/details/108204568 -->
